# @Version  : 1.0
# @Author   : wgq
# @File     : practice02.py
# @Date     : 2025/6/11 19:47


# class Animal:
#     food = '食物'
#     type = '动物'
#     def eat(self):
#         print(f'{self.type}吃{self.food}')
# class Cat(Animal):
#     pass
# animal = Animal()
# animal.eat()
# cat = Cat()
# cat.type = '小花猫'
# cat.food = '小鱼干'
# cat.eat()
# class Father:
#     def basketball(self):
#         print('打篮球')
# class Mom:
#     def sing(self):
#         print('唱歌')
# class Child(Father,Mom):
#     def dance(self):
#         print('跳舞')
# son = Child()
# son.dance()
# son.sing()
# son.basketball()

# class Student:
#     def __init__(self,age,name):
#         self.age = age
#         self.name = name
#     def showInfo(self):
#         print(f"姓名：{self.age} 年龄：{self.name}")
#
# class Pupil(Student):
#     def __init__(self,age,name,sex):
#         super().__init__(age,name)
#         self.sex = sex
#     def showInfo(self):
#         super().showInfo()
#         print(f"性别：{self.sex}")
#
# xiaolan = Pupil(10,"小蓝","女")
# xiaolan.showInfo()

# class Person:
#     def __init__(self,name):
#         self.name = name
#     def who(self):
#         print(f"我是一个人，我的名字是{self.name}")
# class Student(Person):
#     def __init__(self,name,score):
#         super().__init__(name)
#         self.score = score
#     def who(self):
#         print(f"我是一个学生，我的名字是{self.name}，我的成绩是{self.score}")
# class Teacher(Person):
#     def __init__(self,name,course):
#         super().__init__(name)
#         self.course = course
#     def who(self):
#         print(f"我是一个老师，我的名字是{self.name},我教授的课程是{self.course}")
# def showInfo(x):
#     x.who()
# person = Person("小蓝")
# student = Student("小明",70)
# teacher = Teacher("唐果","数学")
# showInfo(person)
# showInfo(student)
# showInfo(teacher)

# class Book:
#     type = "课外书"
#     def __init__(self,price):
#         self.price = price
#     @classmethod
#     def getType(cls):
#         return cls.
# book = Book()
# print(book.getType())
# print(Book.getType())

# class Book:
#     type = "课外书"
#     @staticmethod
#     def printType():
#         print("书的类别".center(30,"-"))
# book = Book()
# book.printType()
# Book.printType()
# print(book.type)
# print(Book.type)



